package cn.tedu.ivos2.dictoption.controller;

import cn.tedu.ivos2.base.response.JsonResult;
import cn.tedu.ivos2.dictoption.pojo.dto.DictOptionQuery;
import cn.tedu.ivos2.dictoption.pojo.dto.DictOptionSaveParam;
import cn.tedu.ivos2.dictoption.pojo.vo.DictOptionVO;
import cn.tedu.ivos2.dictoption.service.DictOptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/v1/dictOption")
public class DictOptionController {
    @Autowired
    DictOptionService dictOptionService;
    @GetMapping("search")
    public JsonResult search(DictOptionQuery  dictOptionQuery) {
        List<DictOptionVO> list = dictOptionService.search(dictOptionQuery);
        return JsonResult.ok(list);
    }
    @PostMapping("save")
    public JsonResult save(DictOptionSaveParam dictOptionSaveParam) {
        dictOptionService.save(dictOptionSaveParam);
        return JsonResult.ok();
    }
    @PostMapping("delete/{id}")
    public JsonResult delete(@PathVariable Long id) {
        dictOptionService.delete(id);
        return JsonResult.ok();
    }
}
